package com.five.bi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.five.bi.mapper.DatasourceInfoMapper;
import com.five.bi.model.request.DataSourceRequest;
import com.five.bi.model.DatasourceInfo;
import com.five.bi.service.DatasourceInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DatasourceInfoServiceImpl extends ServiceImpl<DatasourceInfoMapper, DatasourceInfo> implements DatasourceInfoService {
    @Resource
    private DatasourceInfoMapper dataSourceInfoMapper;

    /**
     * 查询当前数据源下面的表
     * @return
     */
    @Override
    public List<DatasourceInfo> dbList(String dataType) {
        List<DatasourceInfo> list = dataSourceInfoMapper.dbList(dataType);
        return list;
    }

    @Override
    public List<DatasourceInfo> dbLike(String dataType, String search) {
        List<DatasourceInfo> like = dataSourceInfoMapper.dbLike(dataType,search);
        return like;
    }

    /**
     * 查询数据源列表
     * @return
     */
    @Override
    public List<DataSourceRequest> getDataSourceList() {
        List<DataSourceRequest> dataSourceList = dataSourceInfoMapper.getDataSourceList();
        return dataSourceList;
    }
}
